package com.taotao.cart.controller;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by zhang_xming on 2017/3/14.
 */
public class AA {
    public static void main(String[] args) {
        String requestURL = "http://localhost:8786/login";
        Pattern p = Pattern.compile("http://(.*?)/");
        Matcher matcher = p.matcher(requestURL);
        if(matcher.find()){
            System.out.println(matcher.group(0));
            StringBuffer sb = new StringBuffer();
            matcher.appendReplacement(sb, "http://localhost:8888/");  //替换的是整个group()
            matcher.appendTail(sb);
        }
//        m.replaceAll("localhost:8888");
//        System.out.println(requestURL);
    }
}
